package com.ddyx.rest;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ddyx.service.IGoodsService;
import com.ddyx.service.StoreActivityService;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

@Controller
@RequestMapping("/storeActivity")
public class StoreActivityController {
	
	
	@Resource
	StoreActivityService storeActivityService;
	
	@Resource
	IGoodsService goodsService;
	
	/**
	 * 根据类型获取启动页\轮播图
	 */
	@ResponseBody
	@RequestMapping(value = "getActivity", method = RequestMethod.POST)
	public ResponseForm getActivitysByParams(@RequestBody RequestForm param) {
		//Map<String, Object> paramMap = (Map<String, Object>) param.getData();
		return storeActivityService.getActivitysByParams(param);
	}
	
	
//	/**
//	 * 首页折扣
//	 */
//	@ResponseBody
//	@RequestMapping(value = "getActivity", method = RequestMethod.POST)
//	public ResponseForm getActivitysByParams(@RequestBody RequestForm param) {
//		//Map<String, Object> paramMap = (Map<String, Object>) param.getData();
//		return storeActivityService.getActivitysByParams(param);
//	}

	/**
	 * @Title: getActivityGoods
	 * @Description: 获取活动商品列表
	 * @author: wush
	 * @param: @param param
	 * @param: @return
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="getActivityGoods" ,method=RequestMethod.POST)
	public ResponseForm getFindGoods(@RequestBody RequestForm param) {
		return goodsService.getActivityGoods(param);
	}
	
	/**
	 * @Title: addActivity  
	 * @Description: 添加活动信息  
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="addActivity",method=RequestMethod.POST)
	public ResponseForm addActivity(@RequestBody RequestForm param) {
		return storeActivityService.addActivity(param);
	}
	
	/**
	 * @Title: addActivityCheck  
	 * @Description: 添加活动信息時校驗  
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="addActivityCheck",method=RequestMethod.POST)
	public ResponseForm addActivityCheck(@RequestBody RequestForm param) {
		return storeActivityService.addActivityCheck(param);
	}
	
	/**
	 * @Title: updateActivity  
	 * @Description: 修改活动
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="updateActivity",method=RequestMethod.POST)
	public ResponseForm updateActivity(@RequestBody RequestForm param) {
		return storeActivityService.updateActivity(param);
	}
	
	/**
	 * @Title: getActivityById   
	 * @Description: 获取活动详情
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="getActivityById",method=RequestMethod.POST)
	public ResponseForm getActivityById(@RequestBody RequestForm param) {
		return storeActivityService.getActivityById(param);
	}
	

	/**
	 * @Title: searchGoods  
	 * @Description: 搜索活动商品
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="searchGoods",method=RequestMethod.POST)
	public ResponseForm searchGoods(@RequestBody RequestForm param) {
		return goodsService.searchGoods(param);
	}
	
	/**
	 * @Title: getGoodsListByIds  
	 * @Description: 根据多个id查询活动商品
	 * @author: wush
	 * @param: @param param
	 * @param: @return      
	 * @return: ResponseForm
	 */
	@ResponseBody
	@RequestMapping(value="getGoodsListByIds",method=RequestMethod.POST)
	public ResponseForm getGoodsListByIds(@RequestBody RequestForm param) {
		return goodsService.getGoodsListByIds(param);
	}
}
